<{include file="tpl/header.html"}>
<link rel="stylesheet" href="kindedit/themes/default/default.css" />
<link rel="stylesheet" href="kindedit/plugins/code/prettify.css" />

<h2 class="ytadmin-h2"><{$data_return['update_add']}>图片
<a class="pull-right btn btn-info" href="<{spUrl c=picture a=index cat_id=$cat_id}>">返回图片列表</a>
</h2>
<div class="ytadmin-form-wrap clearfix">
	<form class="form-horizontal" role="form" action="<{spUrl c=picture a=opera}>" method="post">	
		<div class="form-group">
			<label for="title" class="col-sm-1 control-label">标题：</label>
			<div class="col-sm-6">
				<input type="text" name="title" id="title" class="form-control" placeholder="标题" value="<{$data_return['title']}>"/>
			</div>
		</div>
		<div class="form-group" >
			<label for="cat" class="col-sm-1 control-label">分类：</label>
			<div class="col-sm-11">
				<select name="cat_id" id="cat" class="form-control" style="width:225px;">
					<{foreach key=key item=cat_item from=$cat_result}>
						<{if $data_return['cat_id']==$cat_item['id']}>
							<option value="<{$cat_item['id']}>" selected="selected"><{$cat_item['name']}></option>
						<{else}>
							<option value="<{$cat_item['id']}>"><{$cat_item['name']}></option>
						<{/if}>
					<{/foreach}>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label for="add_time" class="col-sm-1 control-label">时间：</label>
			<div class="col-sm-6">
				<input type="text" name="add_time" id="add_time" class="form-control ytadmin-input-mid" placeholder="时间" value="<{$data_return['add_time']}>"/>
			</div>
		</div>
		<div class="form-group">
			<label for="description" class="col-sm-1 control-label">描述：</label>
			<div class="col-sm-11">
				<input class="form-control" type="text" name="description" value="<{$data_return['description']}>" />
			</div>
		</div>
		
		<div class="form-group">
			<label for="image" class="col-sm-1 control-label">图片：</label>
			<div class="col-sm-11">
			<!--			
				<input type="button" class="btn btn-default pull-left" id="image" value="选择图片" />
			-->
				<input type="text" id="url" style="width:836px;" class="form-control pull-left" name="dir" value="<{if $data_return['dir']}><{$data_return['dir']}><{/if}>" />
				<input type="hidden" name="height" value="<{$data_return['height']}>"/>
				<div id="img_show_box" style="width:916px;overflow:scroll;">
					<img id="img_show" src="<{if $data_return['dir']}>../<{$data_return['dir']}><{/if}>" />
				</div>
			</div>
		</div>	

		<div class="form-group">
			<input type="hidden" name="update_add" value="<{$data_return['update_add']}>"/>
			<input type="hidden" name="id" value="<{$data_return['id']}>"/>
			<div class="col-sm-offset-1 col-sm-11">
				<input type="submit" name="submit" class="btn btn-info" value="<{$data_return['update_add']}>"/>
			</div>
		</div>
	</form>
</div>

<script charset="utf-8" src="kindedit/kindeditor.js"></script>
<script charset="utf-8" src="kindedit/lang/zh_CN.js"></script>
<script charset="utf-8" src="kindedit/plugins/code/prettify.js"></script>
<script>
	KindEditor.ready(function(K) {
		var editor2 = K.editor({
			allowFileManager : true
		});
		K('#image').click(function() {
			editor2.loadPlugin('image', function() {
				editor2.plugin.imageDialog({
					imageUrl : K('#url').val(),
					clickFn : function(url, title, width, height, border, align) {
						K('#url').val(url);
						$('#img_show').attr('src',url);
						editor2.hideDialog();
					}
				});
			});
		});	
		prettyPrint();
	});
</script>

<{include file="tpl/footer.html"}>